import request from '/@/utils/request'

const apiText = 'supplier'

// 查
export function getSupplierListApi(params: any) {
  return request({
    url: `/api/${apiText}/list`,
    method: 'get',
    params,
  })
}

// 下拉
export function getSupplierAllApi() {
  return request({
    url: `/api/${apiText}/all`,
    method: 'get',
  })
}

// 详情
export function getSupplierDetailsApi(id: any) {
  return request({
    url: `/api/${apiText}/info/${id}`,
    method: 'get',
  })
}

// 增
export function addSupplierListApi(data: any) {
  return request({
    url: `/api/${apiText}/create`,
    method: 'post',
    data,
  })
}

// 改
export function editSupplierListApi(data: any) {
  return request({
    url: `/api/${apiText}/update/${data.id}`,
    method: 'put',
    data,
  })
}

// 删
export function delSupplierListApi(id: any) {
  return request({
    url: `/api/${apiText}/delete/${id}`,
    method: 'delete',
  })
}

// 供应商合同
export function getSupplierContractsApi(params: any) {
  return request({
    url: `/api/${apiText}/contracts`,
    method: 'get',
    params,
  })
}

// 采购排行榜
export function getSupplierPurchasingRankingApi(params: any) {
  return request({
    url: `/api/${apiText}/purchasing_ranking`,
    method: 'get',
    params,
  })
}

// 邀请供应商的 发起邀请公司的详情
export function getInviteCompanyDetailsApi(id: any) {
  return request({
    url: `/api/apply/show/${id}`,
    method: 'get',
  })
}
